#include"ThreadPool.hpp"
#include"Task.hpp"
#include<ctime>
#include<unistd.h>

int main()
{
    srand(time(nullptr));
    //初始化并运行线程池
    // ThreadPool<Task> tp;
    // tp.start();

    ThreadPool<Task>::GetInstance()->start();

    while(1)
    {
        int x = rand()%10+1;
        int y = rand()%5;
        char op = oper[rand()%oper.size()];
        //创建任务
        Task t(x,y,op);
        //把任务加入任务队列中
        ThreadPool<Task>::GetInstance()->push(t);

        cout << "main thread create task" << t.GetTask() <<  endl;
        sleep(1);
    }
    return 0;
}